package p.a5;

public class Angle {

	private final double	alpha;

	public Angle(double alpha) {
		this.alpha = alpha;
	}

	public Angle() {
		this.alpha = 0.0;
	}

	public double getAngle() {
		return alpha;
	}

	@Override
	public String toString() {
		return "w(" + this.alpha + ")";
	}
	
	public Angle add(Angle beta) {
		double newangle = this.alpha;
		newangle = newangle + beta.getAngle();
		while (newangle >= 360.0) {
			newangle = newangle - 360.0;
		}
		Angle omega = new Angle(newangle);
		return omega;
	}

	public Angle sub(Angle beta) {
		double newangle = this.alpha;
		newangle = newangle - beta.getAngle();
		while (newangle < 0.0) {
			newangle = newangle + 360.0;
		}
		Angle omega = new Angle(newangle);
		return omega;
	}

}
